package com.huabo.system.mysql.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.system.mysql.entity.TblJobMySql;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.BaseMapper;

import java.math.BigDecimal;
import java.util.List;

public interface TblJobMySqlDao extends BaseMapper<TblJobMySql> {
    @Select("select * from TBL_JOB where COMPANYID= #{companyid}")
    List<TblJobMySql> listBySql(BigDecimal companyid);

    //    @Insert("INSERT INTO TBL_JOB (JOBID,JOBNAME,COMPANYID) VALUES (#{jobid},#{jobname},#{companyId})")
    @InsertProvider(method = "saveJob", type = TblJobDaoSqlConfig.class)
    void saveJob(TblJobMySql job);

    @Select("SELECT * FROM TBL_JOB WHERE JOBID = #{jid}")
    TblJobMySql selectJid(String jid);

    @Delete("DELETE FROM TBL_JOB WHERE selectedId = #{selectedId}")
    void deleteSelectedId(TblJobMySql selectedId);

    //    @Select("select * from TBL_JOB where COMPANYID=#{companyid}")
    @SelectProvider(method = "selectListByPageInfo", type = TblJobDaoSqlConfig.class)
    List<TblJobMySql> selectListByPageInfo(PageInfo<TblJobMySql> pageInfo, BigDecimal companyId);

    @Select("SELECT * FROM TBL_JOB where COMPANYID= #{companyId}")
    Integer selectListByPageInfoCount(PageInfo<TblJobMySql> pageInfo, BigDecimal companyId);

    @Select("SELECT * FROM TBL_JOB WHERE JOBID = #{jobid}")
    List<TblJobMySql> findByRid(String jobid);

    @UpdateProvider(type = TblJobDaoSqlConfig.class, method = "updateJob")
    void updateJob(TblJobMySql newJob);

    @Select("SELECT count(*) FROM TBL_JOB where COMPANYID= #{companyId}")
    Integer selectListByPageCount(PageInfo<TblJobMySql> pageInfo, BigDecimal companyId);

    @Delete("DELETE FROM TBL_JOB WHERE JOBID = #{jobid}")
    void deleteJob(BigDecimal jobid);
}
